
@echo off

SET SPDIR=C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN

IF [%1]==[-deploy] (
"%SPDIR%\stsadm.exe" -o addsolution -filename %2\%3
REM "%SPDIR%\stsadm.exe" -o deploysolution -name %3 -immediate -allowGacDeployment  -allowCasPolicies -url %4
REM "%SPDIR%\stsadm.exe" -o deploysolution -name %3 -immediate -allowGacDeployment  -allowCasPolicies -allcontenturls
REM "%SPDIR%\stsadm.exe" -o execadmsvcjobs 
PAUSE
GOTO END
) 

IF [%1]==[-retract] (
rem "%SPDIR%\stsadm.exe" -o retractsolution -name %2 -immediate -url %3
rem "%SPDIR%\stsadm.exe" -o retractsolution -name %2 -immediate -allcontenturls
rem "%SPDIR%\stsadm.exe" -o execadmsvcjobs
"%SPDIR%\stsadm.exe" -o deletesolution -name %2
PAUSE
GOTO END
)

echo Use the bath with the following parameters
echo ===========================================
echo CmdSolution.bat -deploy (path to wsp) (name of wsp) (http:\\url)
echo CmdSolution.bat -retract (name of wsp) (http:\\url)
echo ===========================================

:END